PHP Basic Notes

[toc]

#Include & Require
include 和 require 除了处理错误的方式不同之外,在其他方面都是相同的:

require 生成一个致命错误(E_COMPILE_ERROR),在错误发生后脚本会停止执行。
include 生成一个警告(E_WARNING),在错误发生后脚本会继续执行。

#Function

fopen()
fgets()
fclose()
readFromJson()
writeToJson()

The fgets() function returns a line from an open file.
The fgets() function stops returning on a new line, at the specified length, or at EOF, whichever comes first.

#Syntax

.就是 +

explode 就是 splite
-> 就是 .
<br> 转行
var_dump($x)显示type
$cars = array("Volvo","BMW","Toyota"); 创建Array
strlen() 长度

#Validation

  1. htmlspecialchars() function converts special characters to HTML entities
  2. Strip unnecessary characters (extra space, tab, newline) from the user input data (with the PHP trim() function)
  3. Remove backslashes () from the user input data (with the PHP stripslashes() function)

#Post & GEt
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.

Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.

However, because the variables are not displayed in the URL, it is not possible to bookmark the page

总阅读量 :